{include file="public/head" /}
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>物业管理系统</cite></a>
        <a><cite>项目管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
      </div>
      <xblock>
        <button class="layui-btn" onclick="x_admin_show('项目添加','{:url('communityAdd')}',600,600)"><i class="layui-icon"></i>项目添加</button>
        <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>小区名称</th>
            <th>小区唯一识别码</th>
            <th>小区地址</th>
            <th>所属辖区</th>
            <th>项目负责人</th>
            <th>负责人手机</th>
            <th>添加时间</th>
            <th>操作</th>
            <th>小区管理员</th>
          </tr>
        </thead>
        <tbody>
          {foreach $list as $val}
          <tr>
            <td>{$val.name}</td>
            <td>{$val.xmcode}</td>
            <td>{$val.address}</td>
            <td>{$val.belong}</td>
            <td>{$val.contact}</td>
            <td>{$val.phone}</td>
            <td>{$val.time}</td>
            <td class="td-manage">
              <a title="访客扫码" onclick="visitorurl('{$val.id}')">
                <i class="layui-icon">&#xe628;</i>
              </a>
              <button type="button" class="layui-btn  layui-btn-sm" onclick="x_admin_show('编辑','{:url(\'admin/community/communityEdit\')}?id={$val.id}',600,600)" >编辑</button>
              <button type="button" class="layui-btn  layui-btn-danger" onclick="communityDel('{$val.id}')">删除</button>
              <!--
              <a title="删除"  onclick="communityDel('{$val.id}', '{$val.id}')" href="javascript:;" id="{$val.id}">
                <i class="layui-icon">&#xe640;</i>
              </a>-->
            </td>
            <td class="td-manage">
              <!--<a title="添加管理员"  onclick="x_admin_show('添加','{:url(\'adminadd\')}?id={$val.id}',800,600)" class="layui-btn">
                添加
              </a>-->

              <a title="管理员列表"  onclick="x_admin_show('列表','{:url(\'adminlist\')}?community_id={$val.id}',800,600)" class="layui-btn">
                列表
              </a>
            </td>
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
        </div>
      </div>

    </div>
    <script>
      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });

      function communityDel(id){
          layer.confirm('删除后无法恢复,确定要删除吗?', function(){
              $.post('{:url("communityDel")}', { id: id}, function(r){
                  if (r.info) {
                      layer.msg(r.info);
                      setTimeout(function (){
                          window.location.reload();
                      }, 700)
                  }else{
                      layer.msg(r.error)
                      setTimeout(function (){
                          window.location.reload();
                      }, 700)
                  }
              })
          })
        /*if(confirm('确定要删除吗?'))
        { 
          var url = "{:url('communityDel')}?id=" + id
          // console.log(url)
          $('#' + doc).attr('href', url)
        } 
          return false; */
      }


      function visitorurl(id){
          layer.open({
              type: 1,
              skin: 'x-right', //样式类名
              closeBtn: 0, //不显示关闭按钮
              anim: 2,
              shadeClose: true, //开启遮罩关闭
              area: ['80%', '300px'],
              content:
              '<div style="padding: 20px 100px; font-size:18px">'+
              '访客扫码链接：https://www.zz.zfbzhsq.com/visitor/index/index?id='+ id + '<br><br>'+
              '支付宝管理员注册链接：https://www.zz.zfbzhsq.com/visitor/aliuser/register?id='+ id + '<br><br>'+


              '</div>'
          });
      }
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>


  </body>

</html>